<input id="readonly-input" type="text" value="This text should be selected." readonly>
<script>
var input = document.getElementById('readonly-input');
input.select();
</script>
